package com.ruoyi.project.system.book.domain;

import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
//@NoArgsConstructor
//@AllArgsConstructor
//@Data
public class Book extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /** 书籍序号 */
    @Excel(name = "书籍序号", cellType = Excel.ColumnType.NUMERIC)
    private Long bookId;

    /** 书籍编号（ISBN) */
    @Excel(name = "书籍编码" )
    private String bookCode;

    /** 书籍名称 */
    @Excel(name = "书籍名称")
    private String bookName;

    /** 作者名称 */
    @Excel(name = "作者名称")
    private String author;

    /** 书籍简介 */
    @Excel(name = "书籍简介")
    private String bookIntroduction;

    /** 书籍排序 */
    @Excel(name = "书籍排序")
    private String bookSort;

    /** 状态（0正常 1停用） */
    @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
    private String status;

    /**
     * 快捷键：alt + insert
     */
    /** 无参构造 */
    public Book() {
    }
    /** 有参构造 */
    public Book(Long bookId, String bookCode, String bookName, String author, String bookIntroduction, String bookSort, String status) {
        this.bookId = bookId;
        this.bookCode = bookCode;
        this.bookName = bookName;
        this.author = author;
        this.bookIntroduction = bookIntroduction;
        this.bookSort = bookSort;
        this.status = status;
    }

    public Long getBookId() {
        return bookId;
    }

    public void setBookId(Long bookId) {
        this.bookId = bookId;
    }
    @NotBlank(message = "ISBN编码不能为空")
    @Size(min = 0, max = 64, message = "ISBN编码长度不能超过64个字符")
    public String getBookCode() {
        return bookCode;
    }

    public void setBookCode(String bookCode) {
        this.bookCode = bookCode;
    }
    @NotBlank(message = "书籍名称不能为空")
    @Size(min = 0, max = 50, message = "书籍名称长度不能超过50个字符")
    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }
    @NotBlank(message = "作者名称不能为空")
    @Size(min = 0, max = 20, message = "作者名称长度不能超过50个字符")
    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }
    @NotBlank(message = "书籍简介不能为空")
    @Size(min = 0, max = 500, message = "书籍简介长度不能超过50个字符")
    public String getBookIntroduction() {
        return bookIntroduction;
    }

    public void setBookIntroduction(String bookIntroduction) {
        this.bookIntroduction = bookIntroduction;
    }
    @NotBlank(message = "显示顺序不能为空")
    public String getBookSort() {
        return bookSort;
    }

    public void setBookSort(String bookSort) {
        this.bookSort = bookSort;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("bookId", getBookId())
                .append("bookCode", getBookCode())
                .append("bookName", getBookName())
                .append("author", getAuthor())
                .append("bookIntroduction", getBookIntroduction())
                .append("bookSort", getBookSort())
                .append("status", getStatus())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .toString();
    }
}
